<?php

use Doctrine\ORM\Mapping\ClassMetadataInfo;

$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE);
$metadata->setPrimaryTable(array(
   'name' => 'margin_record',
   'uniqueConstraints' => 
   array(
   'type' => 
   array(
    'columns' => 
    array(
    0 => 'type',
    1 => 'uuid',
    ),
   ),
   'type_to_cn' => 
   array(
    'columns' => 
    array(
    0 => 'type_to_cn',
    1 => 'uuid',
    ),
   ),
   ),
   'indexes' => 
   array(
   'user_id' => 
   array(
    'columns' => 
    array(
    0 => 'user_id',
    ),
   ),
   'create_time' => 
   array(
    'columns' => 
    array(
    0 => 'create_time',
    ),
   ),
   ),
  ));
$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT);
$metadata->mapField(array(
   'fieldName' => 'id',
   'columnName' => 'id',
   'type' => 'integer',
   'nullable' => false,
   'options' => 
   array(
   'unsigned' => true,
   'comment' => 'id',
   ),
   'id' => true,
  ));
$metadata->mapField(array(
   'fieldName' => 'uuid',
   'columnName' => 'uuid',
   'type' => 'string',
   'nullable' => false,
   'length' => 40,
   'options' => 
   array(
   'fixed' => true,
   'comment' => '唯一标识',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'userId',
   'columnName' => 'user_id',
   'type' => 'integer',
   'nullable' => false,
   'options' => 
   array(
   'unsigned' => true,
   'comment' => '用户ID',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'recordId',
   'columnName' => 'record_id',
   'type' => 'integer',
   'nullable' => false,
   'options' => 
   array(
   'unsigned' => true,
   'comment' => '产生本条流水的记录ID',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'type',
   'columnName' => 'type',
   'type' => 'integer',
   'nullable' => false,
   'options' => 
   array(
   'unsigned' => true,
   'comment' => '流水类型码1：充值，2：提现，3：放款，4：还款',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'typeToCn',
   'columnName' => 'type_to_cn',
   'type' => 'string',
   'nullable' => false,
   'length' => 30,
   'options' => 
   array(
   'fixed' => false,
   'comment' => '流水类型',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'amount',
   'columnName' => 'amount',
   'type' => 'decimal',
   'nullable' => false,
   'precision' => 20,
   'scale' => 2,
   'options' => 
   array(
   'comment' => '流水金额',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'beforeAvaliableAmount',
   'columnName' => 'before_avaliable_amount',
   'type' => 'decimal',
   'nullable' => false,
   'precision' => 20,
   'scale' => 2,
   'options' => 
   array(
   'comment' => '操作之前可用余额',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'afterAvaliableAmount',
   'columnName' => 'after_avaliable_amount',
   'type' => 'decimal',
   'nullable' => false,
   'precision' => 20,
   'scale' => 2,
   'options' => 
   array(
   'comment' => '操作之后可用余额',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'remark',
   'columnName' => 'remark',
   'type' => 'string',
   'nullable' => true,
   'length' => 250,
   'options' => 
   array(
   'fixed' => false,
   'comment' => '备注',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'status',
   'columnName' => 'status',
   'type' => 'smallint',
   'nullable' => false,
   'options' => 
   array(
   'unsigned' => true,
   'comment' => '100处理中200成功 400失败',
   'default' => '200',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'updateTime',
   'columnName' => 'update_time',
   'type' => 'datetime',
   'nullable' => true,
   'options' => 
   array(
   'comment' => '更新时间',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'createTime',
   'columnName' => 'create_time',
   'type' => 'datetime',
   'nullable' => false,
   'options' => 
   array(
   'comment' => '创建时间',
   ),
  ));
$metadata->mapField(array(
   'fieldName' => 'isAffectedAmount',
   'columnName' => 'is_affected_amount',
   'type' => 'boolean',
   'nullable' => true,
   'options' => 
   array(
   'comment' => '是否会影响可用余额',
   'default' => '0',
   ),
  ));
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_IDENTITY);